//TODO: these functions must avoid saving and returning duplicates
getPrevSql: function() {
if (!this.m_bUseConfig)
return false;
var crit2 = "";
if (this.m_queryId != null)
crit2 = " and id < " + this.m_queryId;
this.m_db.selectQuery('select "id", "value" from ' + this.m_tbl + " where type = 'QueryHistory' and id = (select max(id) from " + this.m_tbl + " where type = 'QueryHistory' " + crit2 + ")");
var aData = this.m_db.getRecords();
if (aData.length > 0) {
this.m_queryId = aData[0][0];
return aData[0][1];
}
return null;
},
getNextSql: function() {
if (!this.m_bUseConfig)
return false;
if (this.m_queryId == null)
return null;
this.m_db.selectQuery("select id, value from " + this.m_tbl + " where type = 'QueryHistory' and id = (select min(id) from " + this.m_tbl + " where type = 'QueryHistory' and id > " + this.m_queryId + ")");
var aData = this.m_db.getRecords();
if (aData.length > 0) {
this.m_queryId = aData[0][0];
return aData[0][1];
}
return null;
},
clearSqlHistory: function() {
if (!this.m_bUseConfig)
return false;
this.m_db.executeTransaction(["delete from " + this.m_tbl + " where type = 'QueryHistory'"]);